package com.mew.chess.core.game.dyj.game.task;

import com.mew.chess.core.common.handler.ChessPushMessageUtil;
import com.mew.chess.core.game.dyj.game.DyjGameManager;
import com.mew.chess.core.game.dyj.game.DyjRoomManager;
import com.mew.chess.core.game.dyj.game.common.DyjConstantValue;
import com.mew.chess.core.game.dyj.game.common.DyjLinkType;
import com.mew.chess.core.game.dyj.game.common.DyjPushCMDMapType;
import com.mew.chess.core.game.dyj.game.message.PushStartBetMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 压注阶段
 * @author dylin
 * @create 2021/4/22
 */
@Component
@Slf4j
public class DyjStartBetTask {
    public void startBet(int roomId){
        DyjRoomManager roomManager = DyjGameManager.getInstance().getController(roomId);
        //------start game-----
        roomManager.changeLink(DyjLinkType.StartBet.code(), DyjConstantValue.START_BET_TIME);
        PushStartBetMessage pushStartBetMessage=roomManager.getPushStartBetMessage();
        ChessPushMessageUtil.broadcastMessage(roomManager.getOnlineUser().values(),DyjPushCMDMapType.StartBetMessage.code(), pushStartBetMessage
                );
    }
}
